<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Backing Up a Database</title>
<link type="text/css" href="../../skin/page.css" rel="stylesheet">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<!--================= start Navigation Path ==================-->
<table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
</tr>
<tr>
<td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
</table>
<!--================= end Navigation Path ==================-->
<!--================= start Banner ==================-->
<table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<!--================= start Group Logo ==================-->
<td bgcolor="#294563"><a href="http://incubator.apache.org"><img border="0" class="logoImage" alt="" src="../../resources/images/apache-incubator.png" title="Derby is a zero admin java based embedded database."></a></td>
<!--================= end Group Logo ==================-->
<!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://incubator.apache.org/derby/"><img border="0" class="logoImage" alt="Derby" src="../../images/derby-logo.jpg" title="Derby is a zero admin java based embedded database."></a></td>
<!--================= end Project Logo ==================-->
<!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
<form target="_blank" action="http://www.google.com/search" method="get">
<table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
<tr>
<td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="incubator.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
<br>
<font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                      the Derby site
                      
                      
                    </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td>
</tr>
</table>
</form>
</td>
<!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td valign="bottom" bgcolor="#294563" colspan="2">
<!--================= start Tabs ==================-->
<div class="tab">
<table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
<table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../../index.html">Home</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../../skin/images/tab-right.gif"></td>
</tr>
<tr>
<td colspan="3" height="1"></td>
</tr>
</table>
</td><td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
<table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a class="base-selected" href="../../manuals/index.html">Manuals</a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td>
</tr>
</table>
</td><td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom">
<table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../../papers/index.html">Papers</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../../skin/images/tab-right.gif"></td>
</tr>
<tr>
<td colspan="3" height="1"></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--================= end Tabs ==================-->
</td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
</table>
<!--================= end Banner ==================-->
<!--================= start Menu, NavBar, Content ==================-->
<table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table summary="menu" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--================= start left top NavBar ==================-->
<td rowspan="3" valign="top">
<table summary="blue line" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
</table>
</td>
<!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
<!--================= start Menu items ==================-->
<div class="menu">
<ul>
<li>
<font color="#CFDCED">Manuals</font>
<ul>
     
<li>
<a href="../../manuals/index.html">About</a>
</li>
     
<li>
<font color="#CFDCED">Getting Started</font>
<ul>
         
<li>
<a href="../../manuals/getstart/gspr02.html" title="Table of Contents">Table of Contents</a>
</li>
         
<li>
<a href="../../manuals/getstart/gspr40.html" title="Index">Index</a>
</li>
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
     
</ul>
</li>
     
<li>
<font color="#CFDCED">Reference Manual</font>
<ul>
         
<li>
<a href="../../manuals/reference/sqlj02.html" title="Table of Contents">Table of Contents</a>
</li>
         
<li>
<a href="../../manuals/reference/sqlj275.html" title="Index">Index</a>
</li>
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
     
</ul>
</li>

     
<li>
<font color="#CFDCED">Developer's Guide</font>
<ul>
         
<li>
<a href="../../manuals/develop/develop02.html" title="Table of Contents">Table of Contents</a>
</li>
         
<li>
<a href="../../manuals/develop/develop157.html" title="Index">Index</a>
</li>
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
     
</ul>
</li>
     
<li>
<font color="#CFDCED">Tuning Derby</font>
<ul>
         
<li>
<a href="../../manuals/tuning/perf02.html" title="Table of Contents">Table of Contents</a>
</li>
         
<li>
<a href="../../manuals/tuning/perf121.html" title="Index">Index</a>
</li>
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
     
</ul>
</li>

     
<li>
<font color="#CFDCED">Server &amp; Admin Guide</font>
<ul>
         
<li>
<a href="../../manuals/admin/hubprnt02.html" title="Table of Contents">Table of Contents</a>
</li>
         
<li>
<a href="../../manuals/admin/hubprnt65.html" title="Index">Index</a>
</li>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
        
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
    
</ul>
</li>

    
<li>
<font color="#CFDCED">Tools &amp; Utility Guide</font>
<ul>
         
<li>
<a href="../../manuals/tools/tools02.html" title="Table of Contents">Table of Contents</a>
</li>
         
<li>
<a href="../../manuals/tools/tools113.html" title="Index">Index</a>
</li>
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
    
</ul>
</li>
  
</ul>
</li>
</ul>
</div>
<!--================= end Menu items ==================-->
</td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td>
</tr>
<tr>
<td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
</table>
</td><td valign="top" width="100%">
<table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
<!--================= start middle NavBar ==================-->
<tr>
<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                &nbsp;
                
                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                &nbsp;
                
                </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<!--================= end middle NavBar ==================-->
<!--================= start Content==================-->
<tr>
<td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td colspan="2" align="left" width="100%">
<div class="content">
<table class="title" summary="">
<tr>
<td valign="middle">
<h1>Backing Up a Database</h1>
</td>
</tr>
</table>
<ul class="minitoc">
<li>
<a href="#Backing+Up+a+Database">Backing Up a Database</a>
</li>
<li>
<a href="#Offline+Backups">Offline Backups</a>
</li>
<li>
<a href="#On-line+Backups">On-line Backups</a>
</li>
<li>
<a href="#Using+the+backup+procedure">Using the backup procedure</a>
</li>
<li>
<a href="#Using+Operating+System+Commands+with+the+freeze+and+unfreeze+system+procedures">Using Operating System Commands with the freeze and unfreeze system procedures</a>
</li>
<li>
<a href="#When+the+Log+is+in+a+non-Default+Location">When the Log is in a non-Default Location</a>
</li>
<li>
<a href="#Backing+Up+Encrypted+Databases">Backing Up Encrypted Databases</a>
</li>
</ul>
<a name="N1003F"></a><a name="Backing+Up+a+Database"></a>
<h3>Backing Up a Database</h3>
<div style="margin-left: 0 ; border: 2px">
<ul>
<li>
<a href="#HDRSII-BUBBKUP-12677">Offline Backups</a>
</li>
<li>
<a href="#HDRSII-BUBBKUP-63476">On-line Backups</a>
</li>
<li>
<a href="#HDRSII-BUBBKUP-67525">When the Log is in a non-Default Location</a>
</li>
<li>
<a href="#HDRSII-BUBBKUP-21105">Backing Up Encrypted Databases</a>
</li>
<li>
<a href="hubprnt49.html#HDRSII-BUBBKUP-66644">Failure Recovery</a>
</li>
<li>
<a href="hubprnt46.html#HDRROLLFORWARD">Roll-forward Recovery</a>
</li>
</ul>
</div>
<a name="N1005C"></a><a name="Offline+Backups"></a>
<h3>Offline Backups</h3>
<div style="margin-left: 0 ; border: 2px">
<p>To perform an offline backup of a database, simply use operating system commands to copy the database directory. The database must be shut down prior to performing an offline backup.</p>
<p>For example, on Windows NT, the following operating system command would back up a (closed) database named <em>sample</em> located in d:\mydatabases by copying it to the directory d:\mybackups\2004-06-01:</p>
<pre>
<strong>xcopy d:\mydatabases\sample d:\mybackups\2004-06-01\sample /s /i</strong>

</pre>
<p>(If you are not using Windows NT, substitute the appropriate operating system command for copying a directory and all contents to a new location.)</p>
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>On Windows NT, do not attempt to update a database while it is being backed up in this way. Attempting to update a database during an off-line backup will generate a <em>java.io.IOException</em>. Using on-line backups prevent this from occurring.</dd>
</dl>
<p>For large systems, shutting down the database might not be convenient. To back up a database without having to take it off line, system administrators should use on-line backups, described next.</p>
</div>
<a name="N10079"></a><a name="On-line+Backups"></a>
<h3>On-line Backups</h3>
<div style="margin-left: 0 ; border: 2px">
<p>Use online backups to back up a database while it is booted. During the interval the backup is running, the database can be read, but writes to the database are blocked.</p>
<p>There are two ways to perform on-line backups:</p>
<ul>
<li>
<a href="#HDRSII-BUBBKUP-94347">Using the backup procedure</a>
</li>
<li>
<a href="#HDRSII-BUBBKUP-75469">Using Operating System Commands with the freeze and unfreeze system procedures</a>
</li>
</ul>
</div>
<a name="N1008B"></a><a name="Using+the+backup+procedure"></a>
<h3>Using the backup procedure</h3>
<div style="margin-left: 0 ; border: 2px">
<p>The <em>SYSCS_UTIL.SYSCS_BACKUP_DATABASE()</em> procedure locks the database and performs the copy operation.</p>
<p>
<a name="IDX252"></a> 
</p>
<p>The <tt><em>SYSCS_UTIL.SYSCS_BACKUP_DATABASE()</em></tt> procedure takes a string argument representing the location in which to back up the database. Typically you provide the full path to the backup directory. (Relative paths are interpreted as relative to the current directory, not to the <tt><em>derby.system.home</em></tt> directory.)</p>
<p>For example, to specify a backup location of c:/mybackups/2004-06-01 for the currently-open database, you would use the following statement:</p>
<pre>
<strong>CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE('c:/mybackups/2004-06-01')</strong>

</pre>
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>Use forward slashes as the path separator in SQL commands.</dd>
</dl>
<p>The <em>SYSCS_UTIL.SYSCS_BACKUP_DATABASE()</em> procedure puts the database into a state in which it can be safely copied, then copies the entire original database directory (including data files, on-line transaction log files, and jar files) to the specified backup directory. Files not within the original database directory (for example, <em>derby.properties</em>) are <em>not</em> copied.</p>
<p>Here is an example, which backs up a database to a directory with a name that reflects the current date:</p>
<pre>public static void backUpDatabase(Connection conn)throws SQLException
{
String backupdirectory ="c:/mybackups/"+JCalendar.getToday();
CallableStatement cs = conn.prepareCall("CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE(?)"); 
cs.setString(1, backupdirectory);
cs.execute(); 
cs.close();
System.out.println("backed up database to "+backupdirectory);
}
</pre>
<p>For a database backed up on 2004-06-01, the above commands copy the current database to a directory of the same name in <em>c:/mybackups/2004-06-01</em>.</p>
<p>Uncommitted transactions do not appear in the backed-up database.</p>
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>Do not back up different databases with the same name to the same backup directory. If a database of the same name already exists in the backup directory, it is assumed to be an older version and is overwritten.</dd>
</dl>
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>If you are doing this through the Network Server, refer to the workaround in <a href="hubprnt19.html#HDRSII-APPS-">Differences between running Derby in embedded mode and using the Network Server</a>.</dd>
</dl>
</div>
<a name="N100D4"></a><a name="Using+Operating+System+Commands+with+the+freeze+and+unfreeze+system+procedures"></a>
<h3>Using Operating System Commands with the freeze and unfreeze system procedures</h3>
<div style="margin-left: 0 ; border: 2px">
<p>Typically, this procedure is used to speed up the copy operation involved in the on-line backup. In this scenario, Derby does not perform the copy operation for you. You use the <em>SYSCS_UTIL.SYSCS_FREEZE_DATABASE()</em> procedure to lock the database, and then explicitly copy the database directory using operating system commands.</p>
<p>For example, because the UNIX <em>tar</em> command uses operating system file-copying routines and Derby uses the IBM Application Developer Kit file-copying routines, tar might provide faster backups than the <em>SYSCS_UTIL.SYSCS_BACKUP_DATABASE</em> procedure.</p>
<p>
<a name="IDX254"></a>  To use operating system commands for on-line database backups, call the <em>SYSCS_UTIL.SYSCS_FREEZE_DATABASE()</em> system procedure. The <em>SYSCS_UTIL.SYSCS_FREEZE_DATABASE()</em> system procedure puts the database into a state in which it can be safely copied. Once the copy is complete, use the <em>SYSCS_UTIL.SYSCS_FREEZE_DATABASE()</em> system procedure to continue working with the database. Only after <em>SYSCS_UTIL.SYSCS_FREEZE_DATABASE()</em> has been specified can transactions once again write to the database. Read operations can proceed while the database is "frozen".</p>
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>To ensure a consistent backup of the database, Derby might block applications that attempt to write to a 'frozen' database until the back up is completed and the <em>SYSCS_UTIL.SYSCS_UNFREEZE_DATABASE()</em>system procedure is called.</dd>
</dl>
<p>The following example demonstrates using <em>freeze</em> and <em>unfreeze</em> surrounding an operating system copy command:</p>
<pre>String backupdirectory = "c:/mybackups/" + JCalendar.getToday();
Statement s = conn.createStatement();
s.executeUpdate(
    "CALL SYSCS_UTIL.SYSCS_FREEZE_DATABASE();
<strong>//copy the database directory during this interval</strong>
s.executeUpdate(
    "CALL SYSCS_UTIL.SYSCS_UNFREEZE_DATABASE();
s.close();
</pre>
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>If you are doing this through the Network Server, refer to the workaround in <a href="hubprnt19.html#HDRSII-APPS-">Differences between running Derby in embedded mode and using the Network Server</a>.</dd>
</dl>
</div>
<a name="N10115"></a><a name="When+the+Log+is+in+a+non-Default+Location"></a>
<h3>When the Log is in a non-Default Location</h3>
<div style="margin-left: 0 ; border: 2px">
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>Read <a href="hubprnt51.html#HDRSII-LOG-98797">Logging on a Separate Device</a> to find out about the default location of the database log.</dd>
</dl>
<p>If you put the database log in a non-default location prior to backing up the database, note the following:</p>
<ul>
<li>If backing up the database using an operating system command, you must explicitly copy the log file as well. <pre>xcopy d:\mydatabases\sample c:\mybackups\2004-06-01\sample /s /i
xcopy h:\janet\tourslog\log c:\mybackups\2004-06-01\sample\log /s /i
</pre>
</li>
</ul>
<dl>
<dt>
<strong>Note:</strong>
</dt>
<dd>If you are not using Windows NT, substitute the appropriate operating system command for copying a directory and all contents to a new location.</dd>
</dl>
<ul>
<li>Edit the <em>logDevice</em> entry in <em>service.properties</em> of the database backup so that it points to the correct location for the log. In the above example, the log was moved to the default location for a log, so you could remove the logDevice entry entirely, or leave the logDevice entry as is and wait until the database is restored to edit the entry.</li>
</ul>
<p>See <a href="hubprnt51.html#HDRSII-LOG-98797">"Logging on a Separate Device"</a> for information about putting the log in a non-default location.</p>
</div>
<a name="N10140"></a><a name="Backing+Up+Encrypted+Databases"></a>
<h3>Backing Up Encrypted Databases</h3>
<div style="margin-left: 0 ; border: 2px">
<p>
<a name="IDX256"></a>  When you back up an encrypted database, both the backup and the log files remain encrypted. To restore an encrypted database, you must know the boot password.</p>
<hr>
<a href="hubprnt42.html">Previous Page</a>
<br>
<a href="hubprnt44.html">Next Page</a>
<br>
<a href="hubprnt02.html#ToC">Table of Contents</a>
<br>
<a href="hubprnt65.html#HDRINDEX_START">Index</a>
</div>
<div class="attribution"></div>
</div>
</td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<!--================= end Content==================-->
</table>
</td>
</tr>
</table>
<!--================= end Menu, NavBar, Content ==================-->
<!--================= start Footer ==================-->
<table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="/favicon.ico"></a></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
          2004&nbsp;Apache Software Foundation All rights reserved.<script type="text/javascript" language="JavaScript"><!--
              document.write(" - "+"Last Published: " + document.lastModified);
            //  --></script></font></td>
</tr>
<tr>
<td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
</tr>
</table>
<!--================= end Footer ==================-->
</body>
</html>
